<!doctype html>
<html>

	<head>
		<meta charset="utf-8">
		<title>排班组合</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../../common/mui/mui.css" rel="stylesheet" />
		<link href="../../common/css/yahei.css" rel="stylesheet" />
		<link href="../../common/css/iconfont.css" rel="stylesheet" />
		<link href="../../common/css/app.css" rel="stylesheet" />
		<style type="text/css">
			.headArea{
				height: var(--size66);
				font-size: var(--size14);
				padding: var(--size10) var(--size15);
				background-color: white;
			}
			.headArea div{
				line-height: var(--size20);
				height: var(--size20);
			}
			.weekDate{
				color: #BBBBBB;
				margin-top: var(--size6);
			}
			table{
				width: calc(100% - var(--size20));
				font-size: var(--size12);
				margin: 0 var(--size10);
			}
			th{
				background-color: ;
				height: var(--size30);
				
				font-weight: normal;
			}
			#wrapper{
				top: calc(44px + 3.84rem);
				background-color: white;
			}
			td{
				text-align: center;
				height: var(--size30);
			}
			tr{
				border-bottom: solid 1px #F4F4F4;
			}
			.nullData{
				margin-top: var(--size60);
				display: none;
			}
		</style>
	</head>

	<body class="YaHei">
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">修改记录</h1>
		</header>
		<div class="mui-content">
			<div class="headArea">
				<div id="ward" class="ward mui-ellipsis"></div>
				<div id="weekDate" class="weekDate">排班周期:</div>
			</div>
			<table class="tableHeader">
				<colgroup><col width="15%"><col width="15%"><col width="20%"><col width="25%"><col width="25%"></colgroup>
				<thead><th>工号</th><th>姓名</th><th>排班日期</th><th>原排班名称</th><th>现在排班名称</th></thead>
			</table>
			<div id="wrapper" class="mui-scroll-wrapper">
				<div class="mui-scroll mui-scroll-phone">
					<table>
						<colgroup><col width="15%"><col width="15%"><col width="20%"><col width="25%"><col width="25%"></colgroup>
						<tbody id="tbody"></tbody>
					</table>
				</div>
			</div>
			<div id="nullData" class="nullData">
				<div class="nullImage"></div>
				<div id="nullTip" class="nullTip">暂无内容</div>
			</div>
		</div>
		
		<script src="../../common/mui/mui.js"></script>
		<script src="../../common/mui/mui.pullToRefresh.js"></script>
		<script src="../../common/mui/mui.pullToRefresh.material.js"></script>
		<script src="../../common/js/jquery-3.4.1.min.js"></script>
		<script src="../../common/js/globalSet.js"></script>
		<script src="../../common/js/DHCWebService.js"></script>
		<script type="text/javascript">
	var nurseid='',start=0,limit=2000;
	var sourceData
	mui.init();
	mui.plusReady(function () {
	    baseSetup();
	})
	if (!mui.os.plus) {
		baseSetup()
	}
	function getRecordData(){
		var pdict = {'start':start,'limit':"",'parr':sourceData.rw+'^'+sourceData.startDate+'^'+sourceData.endDate+'^'+sourceData.wardID,'nurseid':nurseid} //排班表Id^开始日期^结束日期^病区Id
		var paramDict = {'method':'web.INMArgComm:FindArgLogList','params':JSON.stringify(pdict),'type':'RecQuery'}
		//console.log(JSON.stringify(pdict))
		mui.DHCWebService(paramDict, function(result) {
			//console.log(JSON.stringify(result))
			if (result['msgcode'] != '1') {
				mui('#tbody')[0].innerHTML = ''
				showNullTip(result['msg'])
				return
			}
			hideNullTip()
			updateRecordUI(result['data'])
		}, function(errorStr) {
			mui('#tbody')[0].innerHTML = ''
			showNullTip(errorStr,'error')
		});
	}
	/*argDate:日期   logAfter:修改后班次描述   logArgStDate:日期   logBefor:修改前班次描述   logCrtDate:修改日期
	logCrtName:修改人姓名   logCrtTime:修改时间   logMark:修改描述   logPost:修改后或修改前班次
	logReason:原因   logWard:病区描述   perID:工号   perName:姓名   rw:id
	*/
	function updateRecordUI(dataArr){
		var html = '';
		for (var i = 0; i < dataArr.length; i++) {
			var oneData = dataArr[i]
			html +='<tr><td>'+oneData['perID']+'</td><td>'+oneData['perName']+'</td><td>'+oneData['logCrtDate']+'</td>'+
				'<td>'+oneData['logBefor']+'</td><td>'+oneData['logAfter']+'</td></tr>'
		}
		mui('#tbody')[0].innerHTML = html
		if (html == '') {
			showNullTip('暂无修改记录')
		}
	}
	
	
	function baseSetup(){
		mui('.mui-scroll-wrapper').scroll({
			bounce: true,
			indicators: false, //是否显示滚动条
		});

		var self = plus.webview.currentWebview();
		sourceData = self.sourceData
		nurseid=sourceData['nurseid']
		mui('#ward')[0].innerHTML = sourceData['wardDesc']
		mui('#weekDate')[0].innerHTML = '排班周期：'+sourceData.startDate+' 至 '+sourceData.endDate
		mui('#ward')[0].innerHTML = sourceData.wardDesc
		
		var rw = sourceData.rw
		if (rw == "" || rw == undefined) {
			showNullTip('暂无数据');
			return
		}
		getRecordData();
	}

	function showNullTip(msg,type){
		mui('#nullData')[0].style.display = 'block';
		mui('#nullTip')[0].innerHTML = msg
	}
	function hideNullTip(){
		mui('#nullData')[0].style.display = 'none';
	}
		</script>
	</body> 

</html>
